package wx

import (
	"jlpay-sdk-go/pkg/jlpay/core"
	"jlpay-sdk-go/pkg/jlpay/models/trans/mini/wx"
	"jlpay-sdk-go/pkg/jlpay/services"
)

// AuthBindService 微信授权绑定服务
type AuthBindService struct {
	*services.BaseService
}

// NewAuthBindService 创建微信授权绑定服务
func NewAuthBindService(config *core.Config) *AuthBindService {
	return &AuthBindService{
		BaseService: services.NewBaseService(config),
	}
}

// AuthBind 微信授权绑定
func (s *AuthBindService) AuthBind(request *wx.AuthBindRequest) (*wx.AuthBindResponse, error) {
	response := wx.NewAuthBindResponse()
	err := s.Post(request, response, "/open/trans/authbind")
	if err != nil {
		return nil, err
	}
	return response, nil
}
